#include<stdio.h>

int main()
{
	int n[6] = {5,7,4,8,9,1},i,end,j;
		
	for(j=0;j<6;j++)
			printf("%d ",n[j]);
		printf("\n");
	for(i=0;i<5;i++)
	{
		end = n[5];
		for(j=5;j>0;j--)
			n[j] = n[j-1];
		n[0] = end;
		
		for(j=0;j<6;j++)
			printf("%d ",n[j]);
		printf("\n");
	}
}
